
#include "stdafx.h"
#include "WicBitmapFlipRotator.h"

//==============================================================================
// CWicBitmapFlipRotator
//==============================================================================
CWicBitmapFlipRotator::CWicBitmapFlipRotator() : CWicBitmapSource()
{
    m_pIWICBitmapFlipRotator = NULL;
    g_hrLast = g_theImagingFactory->CreateBitmapFlipRotator(&m_pIWICBitmapFlipRotator);
}

CWicBitmapFlipRotator::~CWicBitmapFlipRotator()
{
    if(m_pIWICBitmapFlipRotator)
    {
        m_pIWICBitmapFlipRotator->Release();
    }
    m_pIWICBitmapFlipRotator = NULL;
}

CWicBitmapFlipRotator::CWicBitmapFlipRotator(CWicBitmapFlipRotator const & obj) : CWicBitmapSource()
{
    m_pIWICBitmapFlipRotator = obj.m_pIWICBitmapFlipRotator;
    m_pIWICBitmapFlipRotator->AddRef();
}

CWicBitmapFlipRotator& CWicBitmapFlipRotator::operator=(CWicBitmapFlipRotator const & objBitmapFlipRotator)
{
    if(m_pIWICBitmapFlipRotator)
    {
        m_pIWICBitmapFlipRotator->Release();
    }
    ClearPtr();
    m_pIWICBitmapFlipRotator = objBitmapFlipRotator.m_pIWICBitmapFlipRotator;
    m_pIWICBitmapFlipRotator->AddRef();
    return *this;
}

//==============================================================================
// IWICBitmapFlipRotator
//==============================================================================
HRESULT CWicBitmapFlipRotator::Initialize(
    /* [in] */ CWicBitmapSource *pSource,
    /* [in] */ WICBitmapTransformOptions options)
{
    g_hrLast = m_pIWICBitmapFlipRotator->Initialize(pSource->GetPtr(), options);
    return g_hrLast;
}


